model docbook extends MoC {

  /*******************************************************************************************************************\
   * DocBook nodes                                                                                                   *
  \*******************************************************************************************************************/
  nodes {
    abstract node class Chunk extends Infom;

    node class Series extends Chunk;  
    node class Book extends Chunk;
  
    abstract node class Division extends Chunk;  
    node class Part extends Division;
  
    abstract node class Component extends Chunk;
    node class Preface extends Component;
    node class Chapter extends Component;
    node class Appendix extends Component;
    node class Glossary extends Component;
  
    abstract node class Sectioning extends Chunk;
    node class Sect1 extends Sectioning;
    node class Sect2 extends Sectioning;
    node class Sect3 extends Sectioning;
    node class Sect4 extends Sectioning;
    node class Sect5 extends Sectioning;
    node class Section extends Sectioning;
  
    abstract node class Block extends Chunk;
    node class Paragraph extends Block;
    node class Blockquote extends Block;
  
    abstract node class Navigational extends Chunk;
    node class Index extends Navigational;
  }
  /*******************************************************************************************************************\
   * DocBook edges                                                                                                   *
  \*******************************************************************************************************************/
  edges {
  
    // Note: if ``chunkIn'' would be abstract, then rules like the first propagation rule wouldn't work :(
  
    /*abstract*/ edge class chunkIn extends requiredBy;

    edge class paraIn extends chunkIn
      connect Block -> Component[*],
              Block -> Sectioning;
          
    edge class inComponent extends chunkIn
      connect Sect1 -> Chapter[*], Section -> Chapter[*],
              Sect1 -> Appendix[*], Section -> Appendix[*],
              Sect2 -> Sect1[*],
              Sect3 -> Sect2[*],
              Sect4 -> Sect3[*],
              Sect5 -> Sect4[*],
              Section -> Section[*];
                    
    edge class partOf extends chunkIn
      connect Division -> Book[+],
              Navigational -> Book[+],
              Component -> Book[+],
              Component -> Division[*];
          
    edge class inSeries extends chunkIn
      connect Book -> Series[2:*];
  }
  
  /*******************************************************************************************************************\
   * DocBook equivs                                                                                                  *
  \*******************************************************************************************************************/
  equivs {
    // not yet implemented
  }  
  
  /*******************************************************************************************************************\
   * DocBook rules                                                                                                   *
  \*******************************************************************************************************************/
  rules {
  
    /* Additional DocBook change types 
     */
    enum DBCT extends MoC::CT { moved }
    
    /* Such an ``enum-extension'' (internally) results in:
    
    - enum Moc::CT U {moved}
    - rule markForMoved(v: Infom) {
        modify {
          eval {
            v.effect = Effect::local;
            v.ct     = CT::moved;
          } 
        }
      }    
    */
    
    /* Additional DocBook dependency types
     */
    //enum DBDT extends MoC::DT
    
    // Rules for change impact analysis (CIA) (aka. rippling of effects)
  
    /* On change type ``moved'' ripple effect to dependents
     * connected to moved INFOM via dependency type ``position'' or
     * ``url''.
     */
    rippling on DBCT::moved if {
      provider -d:chunkIn-> dependent;
      if { d.via == DT::position || d.via == DT::url; } //@todo d.via <: DT::Position 
    }
    
    //////////////////////////////////////////
    //
    // DRAFT
    //
    //////////////////////////////////////////
   
    
    // Rules for adaptation (aka. propagation)
    
    // Note: For ``real'' adaptations modifications on the graph have to
    //       be re-mapped (XMLized) to the respective document.
    //       Re-mapping hasn't been implemented yet, though.
    //       Therefore these rules currently serve for experimental purpose only!
    
    propagate on DBCT::_ if {
      premise {
        equiv <-:equivTo- provider -d:chunkIn-> dependent;
        negative { provider.ct == CT::none; }
      }
      conclusion {
        equiv -:typeof(d)-> dependent;        
      }
    }
    
  }   
  
}
